package com.puhui.education.activity;

import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.Button;

import com.puhui.education.R;
import com.puhui.education.activity.base.BaseAcy;
import com.puhui.education.util.TextUtil;
import com.puhui.education.view.FlowLayout;
import com.puhui.education.view.SearchView;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2016/6/20.
 */
public class RecentSearchAcy extends BaseAcy {
    @Bind(R.id.sv_edit_recentSearchAcy)
    SearchView sv_edit;
    @Bind(R.id.bt_search_recentSearchAcy)
    Button bt_search;
    @Bind(R.id.fl_recentSearch_recentSearchAcy)
    FlowLayout fl_recentSearch;
    @Bind(R.id.fl_hotSearch_recentSearchAcy)
    FlowLayout fl_hotSearch;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.acy_recent_search);
        ButterKnife.bind(this, this);
        initEvent();
        initData();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ButterKnife.unbind(this);
    }

    @Override
    protected void initEvent() {
        super.initEvent();
        sv_edit.onEditContenttChangeListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                if(TextUtil.isValidate(s.toString())){
                    bt_search.setClickable(true);
                    bt_search.setSelected(true);
                }else{
                    bt_search.setClickable(false);
                    bt_search.setSelected(false);
                }

            }

            @Override
            public void afterTextChanged(Editable s) {
            }
        });
    }

    @Override
    protected void initData() {
        super.initData();
    }
}
